//
//  PKDiscoveryControllerListCell.swift
//  Panku
//
//  Created by mac on 2017/2/10.
//  Copyright © 2017年 Monster. All rights reserved.
//

import UIKit
import SnapKit
import YYKit

class PKDiscoveryControllerListCell: PKBaseTableViewCell {
    
    //MARK: - properties
    lazy var titleLabel = UILabel()
    lazy var displayView = UIImageView()
    lazy var descriptionLabel = UILabel()
    lazy var thumbUpLabel = UILabel()
    lazy var commentButton = PKBaseButton.createButton()
    lazy var shareButton = PKBaseButton.createButton()

    //设置Cell
    override func setupCell() {
        
        //设置contentView
        contentView.backgroundColor = UIColor.white
        
        contentView.addSubview(titleLabel)
        contentView.addSubview(displayView)
        contentView.addSubview(descriptionLabel)
        contentView.addSubview(thumbUpLabel)
        contentView.addSubview(commentButton)
        contentView.addSubview(shareButton)
        
        //设置UI
        displayView.image = R.image.banner1()
        displayView.snp.makeConstraints { (make) in
            make.top.equalTo(contentView.snp.top)
            make.left.equalTo(contentView.snp.left)
            make.right.equalTo(contentView.snp.right)
            make.height.equalTo(150)
        }
        
        titleLabel.numberOfLines = 1
        titleLabel.textColor = UIColor.black
        titleLabel.text = "当时别道是寻常，民谣新秀谢春花新专辑"
        titleLabel.snp.makeConstraints { (make) in
            make.left.equalTo(displayView.snp.left).offset(11)
            make.right.equalTo(displayView.snp.right).offset(11)
            make.top.equalTo(displayView.snp.bottom).offset(12)
            
        }
        
        descriptionLabel.numberOfLines = 0
        descriptionLabel.text = "当时别道是寻常，民谣新秀谢春花新专辑当时别道是寻常，民谣新秀谢春花新专辑当时别道是寻常，民谣新秀谢春花新专辑当时别道是寻常，民谣新秀谢春花新专辑当时别道是寻常，民谣新秀谢春花新专辑当时别道是寻常，民谣新秀谢春花新专辑当时别道是寻常，民谣新秀谢春花新专辑当时别道是寻常，民谣新秀谢春花新专辑当时别道是寻常，民谣新秀谢春花新专辑"
        descriptionLabel.textColor = UIColor.darkGray
        descriptionLabel.snp.makeConstraints { (make) in
            make.top.equalTo(titleLabel.snp.bottom).offset(15)
            make.left.equalTo(titleLabel.snp.left)
            make.right.equalTo(titleLabel.snp.right)
        }
        
        thumbUpLabel.text = "2100 赞"
        thumbUpLabel.snp.makeConstraints { (make) in
            make.left.equalTo(descriptionLabel.snp.left)
            make.top.equalTo(descriptionLabel.snp.bottom).offset(13)
        }
        
        commentButton.setTitle("50 评论", for: .normal)
        commentButton.setTitleColor(UIColor.darkGray, for: .normal)
        commentButton.snp.makeConstraints { (make) in
            make.top.equalTo(thumbUpLabel.snp.top)
            make.left.equalTo(thumbUpLabel.snp.right).offset(30)
        }
        
        commentButton.addBlock(for: .touchUpInside) { (_) in
            //TODO:打开评论界面
        }
        
        shareButton.setTitle("20分享", for: .normal)
        shareButton.setTitleColor(UIColor.darkGray, for: .normal)
        shareButton.snp.makeConstraints { (make) in
            make.top.equalTo(commentButton.snp.top)
            make.left.equalTo(commentButton.snp.right)
        }
        
        shareButton.addBlock(for: .touchUpInside) { (_) in
            //TODO:打开分享界面
            
        }
        
    }
    
    
    

}
